<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
    var user={
      name:'zcc',
      age:24,
      sex:'male'
    }
    //将对象转化为json字符串，打印结果是{"name":"zcc","age":24,"sex":"male"}
    var jsonUser = JSON.stringify(user);
    //json字符串转化为对象
    var obj = JSON.parse(jsonUser);
    //等价于
    var obj1 = JSON.parse('{"name":"zcc","age":24,"sex":"male"}');
  </script>
</head>
<body>

</body>
</html>